package com.sparkseries;

import com.sparkseries.route.DynamicRouteLoader;
import jakarta.annotation.Resource;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;

@EnableDiscoveryClient
@SpringBootApplication
public class SparkSeriesGatewayApplication implements CommandLineRunner {
    @Resource
    private DynamicRouteLoader loader;

    public static void main(String[] args) {
        SpringApplication.run(SparkSeriesGatewayApplication.class, args);
    }

    /**
     * 加载路由
     * @param args
     */
    @Override
    public void run(String... args) {
        loader.refresh();
    }
}
